﻿using NaturalNote.Core.Database;
using System.Data;
using Dapper;

namespace NaturalNote.Mysql
{
    internal class MysqlDataStorage : IDataStorage
    {
        private readonly IDbConnection con;

        public MysqlDataStorage(IDbConnection con)
        {
            this.con = con;
        }

        public Task Delete<T>(T entity) where T : class, new()
        {
            throw new NotImplementedException();
        }

        public Task Delete<T>(IEnumerable<T> entities) where T : class, new()
        {
            throw new NotImplementedException();
        }

        public Task Delete(string table, object? param = null)
        {
            throw new NotImplementedException();
        }

        public Task ExecSql(string sql, object? param = null)
        {
            throw new NotImplementedException();
        }

        public Task Insert<T>(T entity) where T : class, new()
        {
            throw new NotImplementedException();
        }

        public Task Insert<T>(IEnumerable<T> entitys) where T : class, new()
        {
            throw new NotImplementedException();
        }

        public async Task Save<T>(T entity) where T : class, new()
        {
            var sql = MysqlBuilder<T>.Instance.InsertOnUpdateSql;
            await con.ExecuteAsync(sql, entity);
        }

        public Task Save<T>(IEnumerable<T> entitys) where T : class, new()
        {
            throw new NotImplementedException();
        }

        public Task Update<T>(T enity) where T : class, new()
        {
            throw new NotImplementedException();
        }

        public Task Update<T>(T enity, object param) where T : class, new()
        {
            throw new NotImplementedException();
        }

        public Task Update(string table, object data, object param)
        {
            throw new NotImplementedException();
        }
    }
}
